package com.ruoyi.training.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.training.mapper.TrainingEnviromentMapper;
import com.ruoyi.training.domain.TrainingEnviroment;
import com.ruoyi.training.service.ITrainingEnviromentService;

/**
 * 环境配置Service业务层处理
 * 
 * @author rocc
 * @date 2025-06-12
 */
@Service
public class TrainingEnviromentServiceImpl implements ITrainingEnviromentService 
{
    @Autowired
    private TrainingEnviromentMapper trainingEnviromentMapper;

    /**
     * 查询环境配置
     * 
     * @param id 环境配置主键
     * @return 环境配置
     */
    @Override
    public TrainingEnviroment selectTrainingEnviromentById(Long id)
    {
        return trainingEnviromentMapper.selectTrainingEnviromentById(id);
    }

    /**
     * 查询环境配置列表
     * 
     * @param trainingEnviroment 环境配置
     * @return 环境配置
     */
    @Override
    public List<TrainingEnviroment> selectTrainingEnviromentList(TrainingEnviroment trainingEnviroment)
    {
        return trainingEnviromentMapper.selectTrainingEnviromentList(trainingEnviroment);
    }

    /**
     * 新增环境配置
     * 
     * @param trainingEnviroment 环境配置
     * @return 结果
     */
    @Override
    public int insertTrainingEnviroment(TrainingEnviroment trainingEnviroment)
    {
        trainingEnviroment.setCreateTime(DateUtils.getNowDate());
        return trainingEnviromentMapper.insertTrainingEnviroment(trainingEnviroment);
    }

    /**
     * 修改环境配置
     * 
     * @param trainingEnviroment 环境配置
     * @return 结果
     */
    @Override
    public int updateTrainingEnviroment(TrainingEnviroment trainingEnviroment)
    {
        trainingEnviroment.setUpdateTime(DateUtils.getNowDate());
        return trainingEnviromentMapper.updateTrainingEnviroment(trainingEnviroment);
    }

    /**
     * 批量删除环境配置
     * 
     * @param ids 需要删除的环境配置主键
     * @return 结果
     */
    @Override
    public int deleteTrainingEnviromentByIds(Long[] ids)
    {
        return trainingEnviromentMapper.deleteTrainingEnviromentByIds(ids);
    }

    /**
     * 删除环境配置信息
     * 
     * @param id 环境配置主键
     * @return 结果
     */
    @Override
    public int deleteTrainingEnviromentById(Long id)
    {
        return trainingEnviromentMapper.deleteTrainingEnviromentById(id);
    }
}
